package com.qlc_demo_api.controller;

import com.alibaba.fastjson.JSONObject;
import com.qlc_demo_api.model.ResponseData;
import com.qlc_demo_api.util.CustomTask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@RequestMapping("/user_centor")
public class UserCenterController {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @RequestMapping(value = "/relation/list", method = {RequestMethod.POST})
    @ResponseBody
    public ResponseData getRelationList(@RequestBody JSONObject jsonObject) {
        logger.info(jsonObject.toJSONString());
        return ResponseData.success();
    }

    @RequestMapping(value = "/relation/list2", method = {RequestMethod.POST})
    @ResponseBody
    public ResponseData getRelationList2(@RequestBody JSONObject jsonObject) throws InterruptedException {
        logger.info(jsonObject.toJSONString());
        Thread.sleep(5000);
        return ResponseData.success();
    }

    @RequestMapping(value = "/relation/list3", method = {RequestMethod.POST})
    @ResponseBody
    public ResponseData getRelationList3(@RequestBody JSONObject jsonObject) throws InterruptedException {
        logger.info(jsonObject.toJSONString());
        Thread.sleep(500);
        return ResponseData.success();
    }

    @RequestMapping(value = "/relation/list4", method = {RequestMethod.POST})
    @ResponseBody
    public ResponseData getRelationList4(@RequestBody JSONObject jsonObject) throws InterruptedException {
        logger.info(jsonObject.toJSONString());
        Thread.sleep(1000);
        return ResponseData.success();
    }

    @RequestMapping(value = "/relation/list5", method = {RequestMethod.POST})
    @ResponseBody
    public ResponseData getRelationList5(@RequestBody JSONObject jsonObject) throws InterruptedException {
        logger.info(jsonObject.toJSONString());
        Thread.sleep(3000);
        return ResponseData.success();
    }
}
